//
//  AutobiographyViewController.m
//  ForestPack
//
//  Created by 郑洲 on 2018/7/17.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "AutobiographyViewController.h"

#import "ApplySceneViewController.h"
#import "TechSelectViewController.h"

@interface AutobiographyViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) BaseTableView *tableView;

@end

@implementation AutobiographyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"个性化定制";
    
    self.tableView = [[BaseTableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - NAVIGATION_BAR_HEIGHT - ScreenX375(49)) style:UITableViewStyleGrouped];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.rowHeight = ScreenX375(46);
    self.tableView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.tableView];
    
    UIButton *connectBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - NAVIGATION_BAR_HEIGHT - ScreenX375(49), ScreenX375(258), ScreenX375(49))];
    connectBtn.backgroundColor = REXADECIMALCOLOR(@"#ff9500");
    [connectBtn setTitle:@"联系设计师" forState:UIControlStateNormal];
    [connectBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    connectBtn.titleLabel.font = Kfont(14);
    [connectBtn addTarget:self action:@selector(connect) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:connectBtn];
    
    UIButton *personalBtn = [[UIButton alloc] initWithFrame:CGRectMake(ScreenX375(258), SCREEN_HEIGHT - NAVIGATION_BAR_HEIGHT - ScreenX375(49), SCREEN_WIDTH - ScreenX375(258), ScreenX375(49))];
    personalBtn.backgroundColor = REXADECIMALCOLOR(@"#ed223b");
    [personalBtn setTitle:@"自定义" forState:UIControlStateNormal];
    [personalBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [personalBtn addTarget:self action:@selector(selectType) forControlEvents:UIControlEventTouchUpInside];
    personalBtn.titleLabel.font = Kfont(14);
    [self.view addSubview:personalBtn];
}

- (void)selectType{
    TechSelectViewController *vc = [[TechSelectViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)connect {
    ApplySceneViewController *vc = [[ApplySceneViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellId = @"noteCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
        NSArray *imageName = @[@"情况1",@"情况2",@"情况3"];
        NSArray *noteArr = @[@"我对包装结构不了解",@"我对设计不了解",@"我是老客户，对包装设计都很清楚"];
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(13), ScreenX375(15), ScreenX375(17), ScreenX375(16))];
        imageView.image = [UIImage imageNamed:imageName[indexPath.row]];
        [cell addSubview:imageView];
        
        UILabel *noteLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(44), 0, SCREEN_WIDTH - ScreenX375(57), ScreenX375(46))];
        noteLabel.text = noteArr[indexPath.row];
        noteLabel.textColor = REXADECIMALCOLOR(@"#333333");
        noteLabel.font = Kfont(14);
        [cell addSubview:noteLabel];
        
        UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(ScreenX375(13), ScreenX375(46) - 0.5, SCREEN_WIDTH - ScreenX375(26), 0.5)];
        line.image = [UIImage imageNamed:@"虚线"];
        [cell addSubview:line];
        
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return ScreenX375(53);
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScreenX375(53))];
    view.backgroundColor = [UIColor whiteColor];
    
    UIView *rline = [[UIView alloc] initWithFrame:CGRectMake(0, ScreenX375(15), ScreenX375(3), ScreenX375(23))];
    rline.backgroundColor = ThemeColor;
    [view addSubview:rline];
    
    UILabel *noteLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenX375(13), ScreenX375(15), ScreenX375(300), ScreenX375(24))];
    noteLabel.text = @"如果您有以下情况请联系设计师";
    noteLabel.textColor = REXADECIMALCOLOR(@"#333333");
    noteLabel.font = Kfont(18);
    [view addSubview:noteLabel];
    
    UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(0, ScreenX375(53) - 0.5, SCREEN_WIDTH, 0.5)];
    line.backgroundColor = LineColor;
    [view addSubview:line];
    
    return view;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
